<?php
   class  VES_Vendors_Model_Account_Api  extends  Mage_Api_Model_Resource_Abstract {
        protected     $result ="";
        
        
        protected     $defultCountry="CN";
        
    public  function getRegionId($code){
        
            $dbr = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_read' );
        
            $sql = "select region_id from directory_country_region where country_id='{$this->defultCountry}' AND id_code='{$code}'";
            // $result = $dbr->fetchAll($sql);
            $result = $dbr->fetchOne($sql);      
            return $result;
        
        }
    
        /**
         * 
         * 返回Venor模型
         * @param varchar $email*/      
        protected function _returnVendor($email){
            
            $model = Mage::getModel('vendors/vendor')->loadByEmail($email,1);
            Mage::log("已经存在:".$model->getData());
            if($model->getId()){
                Mage::log("已经存在:".$model->getId());
                return $model;
            }else{
                Mage::log("不存在:".$email);
                return Mage::getModel('vendors/vendor');
            }
        }  
    }